package com.eastfair.home.enumeration;

import com.eastfair.annotation.base.BaseEnum;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * <p>
 * 实体注释中生成的类型枚举
 * 一键报馆记录
 * </p>
 *
 * @author dq
 * @date 2022-10-31
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "VenueReportReportDrawingStatusEnum", description = "报馆图纸状态 #{NOT_REPORT:未上报;PARTIAL_REPORT:部分上报;HAS_REPORT:已上报-枚举")
public enum VenueReportReportDrawingStatusEnum implements BaseEnum {

    /**
     * NOT_REPORT="未上报"
     */
    NOT_REPORT("未上报"),
    /**
     * PARTIAL_REPORT="部分上报"
     */
    PARTIAL_REPORT("部分上报"),
    /**
     * HAS_REPORT="已上报"
     */
    HAS_REPORT("已上报"),
    ;

    @ApiModelProperty(value = "描述")
    private String desc;


    /**
     * 根据当前枚举的name匹配
     */
    public static VenueReportReportDrawingStatusEnum match(String val, VenueReportReportDrawingStatusEnum def) {
        return Stream.of(values()).parallel().filter(item -> item.name().equalsIgnoreCase(val)).findAny().orElse(def);
    }

    public static VenueReportReportDrawingStatusEnum get(String val) {
        return match(val, null);
    }

    public boolean eq(VenueReportReportDrawingStatusEnum val) {
        return val != null && eq(val.name());
    }

    @Override
    @ApiModelProperty(value = "编码", allowableValues = "NOT_REPORT,PARTIAL_REPORT,HAS_REPORT", example = "NOT_REPORT")
    public String getCode() {
        return this.name();
    }

}
